﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;
using Agnes.Core;
using Agnes.Libaray;

namespace Agnes.MyDocsLib
{    
    /// <summary>
    /// 文档预览树Codon 描述信息
    /// </summary>
    public class MyDocsLibSmartTreePad
        : IWorkbenchPad
    {
        private static DocsLibSmartTreeView _docsLibSmartTreeView;

        private static DocsLibSmartTreeViewModel _docsLibSmartTreeViewModel;

        public void SlnClosed(object sender, EventArgs e)
        {
            _docsLibSmartTreeView = null;
            _docsLibSmartTreeViewModel = null;
        }

        public object Content
        {
            get
            {
                if (_docsLibSmartTreeView == null)
                {

                    _docsLibSmartTreeView = new DocsLibSmartTreeView();
                    _docsLibSmartTreeViewModel = new DocsLibSmartTreeViewModel();
                    ViewModelBinder.Bind(_docsLibSmartTreeViewModel, _docsLibSmartTreeView, null);
                   // _docsLibSmartTreeViewModel.ReLoadDate();
                }

                return _docsLibSmartTreeView;
            }
        }

        public string ImageUri
        {
            get { return null; }
        }

        public bool IsHide { get; set; }

        public string Title
        {
            get
            {
                return "我的文档库";
            }
        }

        public WorkbenchPadPosition WorkbenchPadPosition
        {
            get { return WorkbenchPadPosition.Left; }
        }


        public void SlnOpened(object sender, EventArgs e)
        {
            ArticleManager.Instance.Save();
            _docsLibSmartTreeViewModel.ReLoadDate();
        }
    }
}
